package com.rao.vo;

import com.rao.vo.enums.ResultEnum;
import lombok.Data;

/**
 * @Author: raoguang
 * @Date: 2022/08/27/17:40
 * @Description:
 */

@Data
public class Result {
    private long code;
    private String message;
    private Object object;

    public Result() {

    }

    public Result(long code, String message, Object object) {
        this.code = code;
        this.message = message;
        this.object = object;
    }

    public long getCode() {
        return code;
    }

    public void setCode(long code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getObject() {
        return object;
    }

    public void setObject(Object object) {
        this.object = object;
    }

    public static Result success() {
        return new Result(ResultEnum.SUCCESS.getCode(), ResultEnum.SUCCESS.getMessage(), null);
    }

    public static Result success(Object object) {
        return new Result(ResultEnum.SUCCESS.getCode(), ResultEnum.SUCCESS.getMessage(), object);
    }

    public static Result error(ResultEnum respBeanEnum) {
        return new Result(respBeanEnum.getCode(), respBeanEnum.getMessage(), null);
    }

    public static Result error(ResultEnum respBeanEnum, Object object) {
        return new Result(respBeanEnum.getCode(), respBeanEnum.getMessage(), object);
    }


}
